<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;

use Illuminate\Foundation\Auth\AuthenticatesUsers;


class LoginController extends Controller
{
    use AuthenticatesUsers;

    public function create()
    {
    	return view('home.login.login');
    }

    public function store(Request $request) {

    	$data = $request->only('email', 'password');
        
    	if(Auth::attempt($data))
    	{
    		return redirect('/');
    	}
    	return redirect('/user/login');
    }

    public function destroy()
    {
    	Auth::logout();
    	return redirect('/');
    }

    // protected function authenticated(Request $request, $user)
    // {
    //     file_put_contents('authenticated.txt', $user->id);
    //     dd($user);
    // }
}
